package utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class SQLFactory
{
	private static Connection mySqlConnection;
	
	public static Connection getConnectionInstance() throws SQLException
	{
		Connection ret;

		if( mySqlConnection == null )
		{
			try
			{
				Class.forName("com.mysql.jdbc.Driver");
				String user = "root";
				String password = "";
				String url = "jdbc:mysql://localhost:3306/igreja";
				mySqlConnection = DriverManager.getConnection( url, user, password );
			}
			catch ( ClassNotFoundException e )
			{
				e.printStackTrace();
			}
		}
		ret = mySqlConnection;
		
		return ret;
	}
}
